﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyMES.Domain.yjb;

namespace MyMES.Infrastructure.Interface
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="insertSql"></param>
        /// <returns></returns>
        Task Insert(T entity, string insertSql);
        Task Insertobject(object entity, string insertSql);
      



        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="updateSql"></param>
        /// <returns></returns>

        Task Update(T entity, string updateSql);
        Task Updatestatus(object entity, string updateSql);

        /// <summary>
        /// 查询语句并返回实体列表的方法
        /// </summary>
        /// <param name="selectSql"></param>
        /// <returns></returns>
        Task<List<T>> SelectAsync(string selectSql);
        /// <summary>
        /// 根据 ID 获取单个实体的方法
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="selectOneSql"></param>
        /// <returns></returns>
        Task<T> GetOne(int Id, string selectOneSql);
        /// <summary>
        ///  根据 ID 获取实体列表的方法
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="selectSql"></param>
        /// <returns></returns>
        Task<List<T>> GetList(int Id, string selectSql);



        Task<T> GetByIdAsync(int id);

        void Insert(Approval model);


        Task<IEnumerable<T>> QueryAsync<T>(string sql, object param = null);
    }
}
